package 剑指offer_leetcode;

/**
 * JZ28对称的二叉树
 */
public class 剑指Offer28_对称的二叉树 {
    public boolean isSymmetric(TreeNode root) {
        return isTrue(root,root);
    }

    boolean isTrue(TreeNode n1, TreeNode n2){
        if(n1==null && n2==null)
            return true;
        if(n1==null || n2==null || n1.val!=n2.val)
            return false;
        return isTrue(n1.left,n2.right) && isTrue(n1.right,n2.left);
    }
}
